<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
function valida(object){
	var x=object.value;
	if (x==null || x=="")
	  {
	  	object.style.border='2px solid red';
		}
	else
	  {
		object.style.border='2px solid #000';
	  }
}
function focus(object){
	object.style.border='2pt solid #ccc'
}
</script>
</head>
<body>
<form name="myForm" action="#" method="post">
Usuario: 
<input type="text" name="fname" onfocus="focus(this)" onblur="valida(this)">
<input type="password" name="password" onfocus="focus(this)" onblur="valida(this)"/>
<input type="submit" value="Submit">
</form>
</body>
</html>